package com.example.second;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import java.util.Locale;

public class MainActivity extends AppCompatActivity{
    public  static  final  String TAG="mylog";
    TextView out;
    EditText edit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main); //R-res layout布局 drawable图片

        out = findViewById(R.id.textView);
        out.setText("swufe 0314");

        edit=findViewById(R.id.inp);
        String s1=edit.getText().toString();
        Log.i(TAG,"onCreate:s1="+s1);

//        Button btn=findViewById(R.id.btn);
//        btn.setOnClickListener(new View.OnClickListener(){
//            @Override
//            public void onClick(View view) {
//                Log.i(TAG,"onClick:click2222");
//                String s1=edit.getText().toString();
//                String s2=s1.substring(0,3);
//                s2=s2.toUpperCase(Locale.ROOT);
//                out.setText("Hi "+s2);
//            }
//        });
        //btn.setOnClickListener(this);

        Log.i("class1","this is msg()");
        Log.i(TAG,"onCreate:111");
        Log.i(TAG,"onCreate:22222");
    }

    public void myclick(View v) {
        // EditText edit=findViewById(R.id.inp);
        String s1=edit.getText().toString();
        Log.i(TAG,"onClick:s1="+s1);
        Log.i(TAG,"onClick:click...........11111111234");
        out.setText("Hi "+s1);
    }

//    @Override
//    public void onClick(View view) {
//       // EditText edit=findViewById(R.id.inp);
//        String s1=edit.getText().toString();
//        Log.i(TAG,"onClick:s1="+s1);
//        Log.i(TAG,"onClick:click...........11111111234");
//        out.setText("Hi "+s1);
//    }
}